
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta charset="utf-8"></meta>
		<meta name="generator" content="JsDoc Toolkit"></meta>
		<title>object.Loader | JsDoc Reference</title>

		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"></meta>
		<meta name="mobileoptimized" content="0"></meta>
	
		<link rel="stylesheet" href="../css/all.css" media="all"></link>
		<link rel="stylesheet" href="../css/handheld.css" media="only screen and (max-width: 660px)"></link>
		<link rel="stylesheet" href="../css/handheld.css" media="handheld"></link>
		<link rel="stylesheet" href="../css/screen.css" media="screen and (min-width: 661px)"></link>

		<script src="../javascript/all.js"></script>
		<!--[if lt IE 9]>
			<script src="../javascript/html5.js"></script>
		<![endif]-->
	</head>

	<body>

<div class="index">
	<div class="menu">
		<div class="indexLinks">
			<a href="../index.html">Classes</a>
			<a href="../files.html">Files</a>
		</div>
	
		<h2 class="heading1">Classes</h2>
		
		<input type="text" name="classFilter" class="classFilter" id="ClassFilter" placeholder="Filter"></input>
		
		<nav>
			<ul class="classList" id="ClassList">
				
					<li><a href="../symbols/_global_.html">_global_</a></li>
				
					<li><a href="../symbols/Array.html">Array</a></li>
				
					<li><a href="../symbols/dom.html">dom</a></li>
				
					<li><a href="../symbols/dom.Document.html">dom<span class='break'> </span>.<span class='break'> </span>Document</a></li>
				
					<li><a href="../symbols/dom.Element.html">dom<span class='break'> </span>.<span class='break'> </span>Element</a></li>
				
					<li><a href="../symbols/dom.ElementClassList.html">dom<span class='break'> </span>.<span class='break'> </span>ElementClassList</a></li>
				
					<li><a href="../symbols/dom.Elements.html">dom<span class='break'> </span>.<span class='break'> </span>Elements</a></li>
				
					<li><a href="../symbols/dom.FormElement.html">dom<span class='break'> </span>.<span class='break'> </span>FormElement</a></li>
				
					<li><a href="../symbols/dom.FormItemElement.html">dom<span class='break'> </span>.<span class='break'> </span>FormItemElement</a></li>
				
					<li><a href="../symbols/dom.Window.html">dom<span class='break'> </span>.<span class='break'> </span>Window</a></li>
				
					<li><a href="../symbols/events.html">events</a></li>
				
					<li><a href="../symbols/Function.html">Function</a></li>
				
					<li><a href="../symbols/mvc.html">mvc</a></li>
				
					<li><a href="../symbols/net.html">net</a></li>
				
					<li><a href="../symbols/object.html">object</a></li>
				
					<li><a href="../symbols/Object.html">Object</a></li>
				
					<li><a href="../symbols/object.Loader.html">object<span class='break'> </span>.<span class='break'> </span>Loader</a></li>
				
					<li><a href="../symbols/options.html">options</a></li>
				
					<li><a href="../symbols/options.Arguments.html">options<span class='break'> </span>.<span class='break'> </span>Arguments</a></li>
				
					<li><a href="../symbols/options.Options.html">options<span class='break'> </span>.<span class='break'> </span>Options</a></li>
				
					<li><a href="../symbols/string.html">string</a></li>
				
					<li><a href="../symbols/ua.html">ua</a></li>
				
					<li><a href="../symbols/ua.extra.html">ua<span class='break'> </span>.<span class='break'> </span>extra</a></li>
				
					<li><a href="../symbols/ui.html">ui</a></li>
				
					<li><a href="../symbols/ui.Component.html">ui<span class='break'> </span>.<span class='break'> </span>Component</a></li>
				
					<li><a href="../symbols/ui.Components.html">ui<span class='break'> </span>.<span class='break'> </span>Components</a></li>
				
					<li><a href="../symbols/ui.decorators.html">ui<span class='break'> </span>.<span class='break'> </span>decorators</a></li>
				
					<li><a href="../symbols/ui.nav.html">ui<span class='break'> </span>.<span class='break'> </span>nav</a></li>
				
					<li><a href="../symbols/ui.nav.ForeNextControl.html">ui<span class='break'> </span>.<span class='break'> </span>nav<span class='break'> </span>.<span class='break'> </span>ForeNextControl</a></li>
				
					<li><a href="../symbols/uiold.html">uiold</a></li>
				
					<li><a href="../symbols/uiold.ForeNextControl.html">uiold<span class='break'> </span>.<span class='break'> </span>ForeNextControl</a></li>
				
					<li><a href="../symbols/uiold.TabControl.html">uiold<span class='break'> </span>.<span class='break'> </span>TabControl</a></li>
				
					<li><a href="../symbols/urlparser.html">urlparser</a></li>
				
					<li><a href="../symbols/validator.html">validator</a></li>
				
			</ul>
		</nav>
	</div>
	<div class="fineprint" style="clear:both">
		
		Documentation generator: <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0<br />
		Template: <a href="http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/" target="_blank">Codeview</a> 1.2<br />
		Generated on: 2011-6-14 18:33
	</div>
</div>

<div class="index indexStatic"></div>

<div class="content">
	<div class="innerContent">
		<h1 class="classTitle">
			
			Class <span>object.Loader</span>
		</h1>
		
		<div class="intro">
			<p class="description summary">
				
			</p>
				
			
				<ul class="summary">
					
					
					
						<li>Defined in: <a href="../symbols/src/d__works_workspace_objectjs.org_object_src__object.js.html">object.js</a></li>
					
						
				</ul>
			
		</div>
		
		
			<div class="props">
				<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class object.Loader.">
					<caption class="sectionTitle">Class Summary</caption>
					<thead>
						<tr>
							<th scope="col">Constructor Attributes</th>
							<th scope="col">Constructor Name and Description</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td class="attributes">&nbsp;</td>
							<td class="nameDescription" >
								<div class="fixedFont">
									<b><a href="../symbols/object.Loader.html#constructor">object.Loader</a></b>()
								</div>
								<div class="description">object的包管理器
这个class依赖于object._lib ，且会修改它</div>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		
		
		
			
			
				<div class="props">
					<table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class object.Loader.">
						<caption class="sectionTitle">Field Summary</caption>
						
						<thead>
							<tr>
								<th scope="col">Field Attributes</th>
								<th scope="col">Field Name and Description</th>
							</tr>
						</thead>
						
						<tbody>
							
								<tr>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont">
										<b><a href="../symbols/object.Loader.html#loadScript">loadScript</a></b>
										</div>
										<div class="description">加载一个script, 执行callback
有冲突检测，如果连续调用两次loadScript同一src的话，则第二个调用会等第一个完毕后直接执行callback，不会加载两次。</div>
									</td>
								</tr>
							
						</tbody>
					</table>
				</div>
			
			
			
		
<!--
#### METHODS SUMMARY
-->
		
			
			
			<div class="props">
				<h2 class="sectionTitle">Method Summary</h2>
				
				
					<table class="summaryTable" id="MethodsList" cellspacing="0" summary="A summary of the methods documented in the class object.Loader.">
						<thead>
							<tr>
								<th scope="col">Method Attributes</th>
								<th scope="col">Method Name and Description</th>
							</tr>
						</thead>
						
						<tbody>
							
							
								<tr
									 class='item0'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#add">add</a></b>(name, uses, context, context)
										</div>
										<div class="description">传入context，context的参数会包含use进来的module
创造一个context，内部通过 this.xxx 设置的成员都会在这个 context 下。</div>
									</td>
								</tr>
							
								<tr
									 class='item1'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#execute">execute</a></b>(name, options, options)
										</div>
										<div class="description">execute</div>
									</td>
								</tr>
							
								<tr
									 class='item2'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#executeModule">executeModule</a></b>(pkg, host, modules, callback, options, options)
										</div>
										<div class="description">context 执行方法</div>
									</td>
								</tr>
							
								<tr
									 class='item3'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#getModule">getModule</a></b>(name, modules, callback, callback)
										</div>
										<div class="description">通过一个模块名，获得到相对应的模块对象并通过callback返回</div>
									</td>
								</tr>
							
								<tr
									 class='item4'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#getUses">getUses</a></b>(uses, ignore, ignore)
										</div>
										<div class="description">处理传入的uses参数，输入格式：
['module1', {
	name: 'module2',
	uses: [
		{
			name: 'Member1',
			as: 'M'
		},
		'Member2'
	]
}, {
	name: 'full.module.name',
	as: 'shortname'
}, {
	name: 'somemodule',
	uses: '*'
}];

输出格式：
[{
	name: 'module1'
}, {
	name: 'module2',
	uses: [
		{
			name: 'Member1',
			as: 'M'
		}, {
			name: 'Member2'
		}
	]
}, {
	name: 'full.module.name',
	as: 'shortname'
}, {
	name: 'somemodule',
	uses: '*'
}];

在getUses阶段不需要根据名称判断去重（比如自己use自己），因为并不能避免所有冲突，还有循环引用的问题（比如 core use dom, dom use core）
因此限定：globalUses 中声明的模块不允许有use</div>
									</td>
								</tr>
							
								<tr
									 class='item5'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#initialize">initialize</a></b>(self)
										</div>
										<div class="description"></div>
									</td>
								</tr>
							
								<tr
									 class='item6'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#loadLib">loadLib</a></b>(self)
										</div>
										<div class="description">查找页面中的标记script标签，更新 _lib</div>
									</td>
								</tr>
							
								<tr
									 class='item7'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#makePrefixPackage">makePrefixPackage</a></b>(self, name)
										</div>
										<div class="description">建立前缀模块
比如 a.b.c.d ，会建立 a/a.b/a.b.c 三个空模块，最后一个模块为目标模块，不为空，内容为context</div>
									</td>
								</tr>
							
								<tr
									 class='item8'
								>
									<td class="attributes">&nbsp;</td>
									<td class="nameDescription">
										<div class="fixedFont"><b><a href="../symbols/object.Loader.html#use">use</a></b>(uses, context, context)
										</div>
										<div class="description">use
uses参数书写有一个技巧，写在后面的module在运行时可以通过runtime参数得到之前已经引入module的引用
这对于利用引入对象做处理的模块来说是一个很重要的特性</div>
									</td>
								</tr>
							
						</tbody>
					</table>
				
			
				
			</div>
		
		
<!--
#### EVENTS SUMMARY
-->
		
<!--
#### CONSTRUCTOR DETAILS
-->
		
			<div class="details props">
				<div class="innerProps">
					<h2 class="sectionTitle" id="constructor">
						Class Detail
					</h2>
					
					<div class="fixedFont">
						<b>object.Loader</b>()
					</div>
					
					<div class="description">
						object的包管理器
这个class依赖于object._lib ，且会修改它
						
					</div>
					
					
				
					
					
					
				</div>
			</div>
		
<!--
#### FIELD DETAILS
-->
		
			<div class="details props">
				<div class="innerProps">
					<h2 class="sectionTitle">
						Field Detail
					</h2>
					
					
						<div class="fixedFont heading" id="loadScript">
							<span class='lighter'>
							
							</span>
							
							
							
							<b>loadScript</b>							
						</div>
						
						<div class="description">
							加载一个script, 执行callback
有冲突检测，如果连续调用两次loadScript同一src的话，则第二个调用会等第一个完毕后直接执行callback，不会加载两次。
							
							
							
						</div>
						
						
							
						
						
					
				</div>
			</div>
		
<!--
#### METHOD DETAILS
-->		
		
			<div class="details props">
				<div class="innerProps">
					<h2 class="sectionTitle">
						Method Detail
					</h2>
					
					<ul class="methodDetail" id="MethodDetail">
						
						
							<li 
								 class='item0'
							>
								<div class="fixedFont heading" id="add">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>add</b>(name, uses, context, context)
								</div>
								
								<div class="description">
									传入context，context的参数会包含use进来的module
创造一个context，内部通过 this.xxx 设置的成员都会在这个 context 下。
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>name</b>
												
											</dt>
											<dd>名称</dd>
										
											<dt>
												<b>uses</b>
												
											</dt>
											<dd>用逗号分隔开的模块名称列表</dd>
										
											<dt>
												<b>context</b>
												
											</dt>
											<dd>这个function会在调用module时调用，并将module通过参数传入context，第一个参数为runtime，后面的参数为每个module的不重复引用，顺序排列</dd>
										
											<dt>
												<b>context</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item1'
							>
								<div class="fixedFont heading" id="execute">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>execute</b>(name, options, options)
								</div>
								
								<div class="description">
									execute
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>name</b>
												
											</dt>
											<dd>执行的入口模块名称</dd>
										
											<dt>
												<b>options</b>
												
											</dt>
											<dd>传入参数</dd>
										
											<dt>
												<b>options</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item2'
							>
								<div class="fixedFont heading" id="executeModule">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>executeModule</b>(pkg, host, modules, callback, options, options)
								</div>
								
								<div class="description">
									context 执行方法
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>pkg</b>
												
											</dt>
											<dd>被执行的pkg</dd>
										
											<dt>
												<b>host</b>
												
											</dt>
											<dd>context回调的this指针会指向它</dd>
										
											<dt>
												<b>modules</b>
												
											</dt>
											<dd>保存了此次use运行过程中用到的所有module</dd>
										
											<dt>
												<b>callback</b>
												
											</dt>
											<dd>异步方法，执行完毕后调用</dd>
										
											<dt>
												<b>options</b>
												
											</dt>
											<dd>可选，可用来定制name</dd>
										
											<dt>
												<b>options</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item3'
							>
								<div class="fixedFont heading" id="getModule">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>getModule</b>(name, modules, callback, callback)
								</div>
								
								<div class="description">
									通过一个模块名，获得到相对应的模块对象并通过callback返回
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>name</b>
												
											</dt>
											<dd>pkg name</dd>
										
											<dt>
												<b>modules</b>
												
											</dt>
											<dd>已引入的module对象列表，会传递给 execute 方法，可以通过sys.modules获取</dd>
										
											<dt>
												<b>callback</b>
												
											</dt>
											<dd>模块获取到以后，通过callback的第一个参数传递回去</dd>
										
											<dt>
												<b>callback</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd>最终引入的模块</dd>
											
										
										
										
										
										
									
									</dl>
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item4'
							>
								<div class="fixedFont heading" id="getUses">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>getUses</b>(uses, ignore, ignore)
								</div>
								
								<div class="description">
									处理传入的uses参数，输入格式：
['module1', {
	name: 'module2',
	uses: [
		{
			name: 'Member1',
			as: 'M'
		},
		'Member2'
	]
}, {
	name: 'full.module.name',
	as: 'shortname'
}, {
	name: 'somemodule',
	uses: '*'
}];

输出格式：
[{
	name: 'module1'
}, {
	name: 'module2',
	uses: [
		{
			name: 'Member1',
			as: 'M'
		}, {
			name: 'Member2'
		}
	]
}, {
	name: 'full.module.name',
	as: 'shortname'
}, {
	name: 'somemodule',
	uses: '*'
}];

在getUses阶段不需要根据名称判断去重（比如自己use自己），因为并不能避免所有冲突，还有循环引用的问题（比如 core use dom, dom use core）
因此限定：globalUses 中声明的模块不允许有use
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>uses</b>
												
											</dt>
											<dd>输入</dd>
										
											<dt>
												<b>ignore</b>
												
											</dt>
											<dd>跳过ignore模块，用来避免自己调用自己</dd>
										
											<dt>
												<b>ignore</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item5'
							>
								<div class="fixedFont heading" id="initialize">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>initialize</b>(self)
								</div>
								
								<div class="description">
									
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>self</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item6'
							>
								<div class="fixedFont heading" id="loadLib">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>loadLib</b>(self)
								</div>
								
								<div class="description">
									查找页面中的标记script标签，更新 _lib
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>self</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item7'
							>
								<div class="fixedFont heading" id="makePrefixPackage">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>makePrefixPackage</b>(self, name)
								</div>
								
								<div class="description">
									建立前缀模块
比如 a.b.c.d ，会建立 a/a.b/a.b.c 三个空模块，最后一个模块为目标模块，不为空，内容为context
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>self</b>
												
											</dt>
											<dd></dd>
										
											<dt>
												<b>name</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								<div class="hr"></div>
							</li>
						
							<li 
								 class='item8'
							>
								<div class="fixedFont heading" id="use">
									<span class='lighter'>
									
									</span>
									
									
									
									<b>use</b>(uses, context, context)
								</div>
								
								<div class="description">
									use
uses参数书写有一个技巧，写在后面的module在运行时可以通过runtime参数得到之前已经引入module的引用
这对于利用引入对象做处理的模块来说是一个很重要的特性
									
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<b>uses</b>
												
											</dt>
											<dd>用逗号分隔开的模块名称列表</dd>
										
											<dt>
												<b>context</b>
												
											</dt>
											<dd>uses加载后调用，将module通过参数传入context，第一个参数为runtime，后面的参数为每个module的不重复引用，顺序排列</dd>
										
											<dt>
												<b>context</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
								
							</li>
						
					</ul>
				</div>
			</div>
		
		
<!--
#### EVENT DETAILS
-->		
		
	</div>
</div>
		<script type="text/javascript">
			wbos.CssTools.MediaQueryFallBack.LoadCss('../css/screen.css', '../css/handheld.css', 660)
			codeview.classFilter.Init()
		</script>
	</body>
</html>

